package com.study.java.base.lianxi;

public class Test1 {
    public static void main(String[] args){
        //ti2();
        //ti4(120156, 120198);
//        ti5();
//        ti6();
//        ti7(122);
        //ti10( 18536);
       // ti11('A',16,6);
//        ti12('A',5);

        ti10_2(789484948);

    }


    public static void ti2(){
        int x = 12;
        System.out.println(x);
        System.out.println(x++);
        // i++, ++i
    }

    public static void ti3(){
        // 变量, 常量
        // 变量(可变变量, 不可变变量(只读))
        String name;
        final long number;
        short age;
        boolean xueji;
        char sex = '女';
    }

    public static void ti4(int min, int max){
        System.out.print("{");
        String m ="过";
        for (int i=min; i<=max; i++){
            if(i%7==0 || ti4_2(i) ){
               m = "过";
            }else {
                m = String.valueOf(i);
            }
            System.out.print(m );
            if (i<max){
                System.out.print(", ");
            }
        }

        System.out.print("}");

        // 61  71  81
        // 6   7   8
        // 6   0   1
    }

    public static boolean ti4_2(int num){
        while (num>0){
            if (num%10==7){
                return true;
            }
            num = num/10;
        }
        return false;
    }

    public static void ti5(){
        int x = 5;
        float y = 6;
        System.out.println(x*y);
    }

    public static void ti6(){
        float x = 6;
        float y = 6.5f;
        float z = x*y;

        System.out.println(z);
    }

    public static void ti7(int num){
        int temp = num;
        String b = "";
        while (num>0){
            if (num%2==0){
                b = "0"+b;
            } else {
                b = "1"+b;
            }
            num = num/2;
        }
        System.out.println(temp+"转二进制: "+b);
    }

    public static void ti9(int score){
        if(score>=0 & score<=120){
            if(score>100) {
                System.out.println("您的等级为:[A+]");
            }
            else if(score>89){
                System.out.println("您的等级为:[A]");
            }else if(score>75 ){
                System.out.println("您的等级为:[B]");
            }else if(score>59){
                System.out.println("您的等级为:[C]");
            }else {
                System.out.println("您的等级为:[D]");
            }
        }else{
            System.out.println("你的成绩无效");
        }
    }

    public static void ti10(int h){
        // 打印输出一个数的个位数，十位数，百位数。
        int wan,qian,bai,shi,ge;
        if (h > -100000 & h < 100000){
            wan = (byte) (h /10000);
            qian = (byte) (h /1000%10);
            bai = (byte) (h /100%10);
            shi = (byte) (h /10%10 );
            ge = (byte) (h  % 10);
            System.out.println(wan);
            System.out.println(qian);
            System.out.println(bai);
            System.out.println(shi);
            System.out.println(ge);
         }else {
            System.out.println("请输入正确的数字!!!");
        }

    }

    public static void ti10_2(int num){
        int wei = 0;
        while (num>0){
            System.out.println("第 "+(wei++) +" = "+num%10);
            num = num/10;
        }

    }



    //接受3个参数, 第一个为字符, 第二个宽度数, 第三个为高度行数
    public static void ti11(char m, int c, int g){
        for (int i = 0; i < g; i++) {
            for (int i1 = 0; i1 < c; i1++) {
                if (i==0){
                    System.out.print(m);

                }
                else if (i==g-1) {
                    System.out.print(m);
                } else {
                    if (i1==0){
                        System.out.print(m);
                    } else if (i1==c-1) {
                        System.out.print(m);
                    } else {
                        System.out.print(" ");
                    }
                }
            }
            System.out.println();
        }




    }




    public static  void ti12(char n,int g) {
        for (int i =1; i <= g; i++) {
            for (int j =1;j<=g-i;j++){
                System.out.print(" ");
            }
            for (int k = 1; k <= 2 * i - 1; k++){
                System.out.print(n);
            }
            System.out.println( );
        }
    }

}



